import {
  defineConfig
} from 'vite'
import veauryVitePlugins from 'veaury/vite/index.js'
import vue from '@vitejs/plugin-vue'

import {
  resolve
} from "path"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [veauryVitePlugins({
    type: 'vue'
  })],
  define: {
    'process.env': {},
  },

  // ↓解析配置
  resolve: {
    // ↓路径别名
    alias: {
      "@": resolve(__dirname, "./src")
    }
  },
  server: {
    proxy: {
      // '/user': {
      //   target: 'http://huaan_api.hfshuoxian.cn', //目标url
      //   changeOrigin: true, //支持跨域
      //   rewrite: (path) => path.replace(/^\/user/, ""),
      //   // rewrite: (path) => path.replace(/^\/token/, ""),
      //   //重写路径,替换/api
      // },
      '/knowclub-api': {
        target: 'http://www.xpertbay.com', //目标url
        changeOrigin: true, //支持跨域
        ws: true,
        secure: false,
        // rewrite: (path) => path.replace(/^\/plant/, "")
        // pathR
      },
      '/xpert-api': {
        target: 'http://www.xpertbay.com', //目标url
        changeOrigin: true, //支持跨域
        ws: true,
        secure: false,
        // rewrite: (path) => path.replace(/^\/plant/, "")
        // pathR
      },
    },

  }
})